UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rPzH8MRNuOC68IGRNCM6+idCtPMfkQaVgqADk+erDkw=' 
WHERE 
  key_id = '1c65070169be384ccf72d026101b703ca90215f818a1b1f3f56df55b2a33952b' 
  AND (
    token = 'rPzH8MRNuOC68IGRNCM6+idCtPMfkQaVgqADk+erDkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023