UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1rHtsNhuEEckThgSx3R7gRniMsOqH8MjF+rnl69UzE=' 
WHERE 
  key_id = 'cc959f886748ff995041487b71e048342dd6548ca16d478883aac2efe95f2578' 
  AND (
    token = 'k1rHtsNhuEEckThgSx3R7gRniMsOqH8MjF+rnl69UzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036