UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CRifpi+VxDt+1j9GyJg9il4KSolAcZ+dZ+KxTb8xGYE=' 
WHERE 
  key_id = '1f9b6c525e448131b63ab6ea5cd2d8e3d3c99ac6495e332298cc9b72bab457e3' 
  AND (
    token = 'CRifpi+VxDt+1j9GyJg9il4KSolAcZ+dZ+KxTb8xGYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042