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

Query time 0.00042