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

Query time 0.00032