UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cpTENCfeg9IO7iMJHTqVrCBYmfkAmoEMVtoAkglNzsw=' 
WHERE 
  key_id = 'aa2a048c01307c2bbfe10080893e09aa745c26f769a6dc844e56042cf2923f6f' 
  AND (
    token = 'cpTENCfeg9IO7iMJHTqVrCBYmfkAmoEMVtoAkglNzsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041