UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77i2okfcevF8SwtvrLfEoQlnVx4dejHAOOAIaKVlojA=' 
WHERE 
  key_id = '652c77d22a0c1b1dd55df68da3ee34c15813851b5ccb5e33a0f22c36cd73eaa1' 
  AND (
    token = '77i2okfcevF8SwtvrLfEoQlnVx4dejHAOOAIaKVlojA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031