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

Query time 0.00026