UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F9r4yrMXUP6KrQlgfamSHPpF3bmHcKCZWrOZd1pYZkg=' 
WHERE 
  key_id = '8d9893a3e10193b87229972b7b87ff2f103c34190e87f789c47b90a118f84880' 
  AND (
    token = 'F9r4yrMXUP6KrQlgfamSHPpF3bmHcKCZWrOZd1pYZkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024