UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+y4Hz0WM7j4rX4gh0wmabHg+S74c/EoVAOZMwAKkroQ=' 
WHERE 
  key_id = '7cc840a5660c10b931970d91cecc7f3e231f2be181af0074410981984a1134c6' 
  AND (
    token = '+y4Hz0WM7j4rX4gh0wmabHg+S74c/EoVAOZMwAKkroQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017