UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jbyxaf5M4/+ir4wf5K4tAM1LfepfwBQ2Xy43Geh/r5w=' 
WHERE 
  key_id = '6be0e5f8336d8aa60bdf61fe01f6502c1b2c61cd2015012d9da020ef8c0e6719' 
  AND (
    token = 'jbyxaf5M4/+ir4wf5K4tAM1LfepfwBQ2Xy43Geh/r5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030