UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYrKGOuvN5baNp10Y4ml+HHXVcaXraAnjjXWCGrjHyo=' 
WHERE 
  key_id = '24ad9a05bbb73497f245b0b6abdbbfad9ee6534edd3ee3c6fff96c9fc6593495' 
  AND (
    token = 'DYrKGOuvN5baNp10Y4ml+HHXVcaXraAnjjXWCGrjHyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040