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

Query time 0.00016