UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5BHQEmPWsCoigImrmmj+sqTGbiuiLn7WX4sXGPsWm8=' 
WHERE 
  key_id = '28696d29063885456c418067e3cd2a70c703cb6678a6c8741268a2cac9cb91cb' 
  AND (
    token = 'D5BHQEmPWsCoigImrmmj+sqTGbiuiLn7WX4sXGPsWm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032