UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nUJZHFqDOQ01Dl+GeE2Uq/DJaB+03PZNU1V+9S0YD6Y=' 
WHERE 
  key_id = '056e6fc239835de1606a9686b20653a3e6566c45183e6205953baac6bf639837' 
  AND (
    token = 'nUJZHFqDOQ01Dl+GeE2Uq/DJaB+03PZNU1V+9S0YD6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049