UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USBmhvziDe854eMqEcO4f2ojbkKfjecjc9T1R+z/coI=' 
WHERE 
  key_id = '33246ae577a0f5cbb84e24fe1deb87e9177043ee487fea9f0d8ba490f6643037' 
  AND (
    token = 'USBmhvziDe854eMqEcO4f2ojbkKfjecjc9T1R+z/coI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028