UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WD+kvg05ZOgQT16VAE+E6WapDlzB2l6Yy720vXpfJ6I=' 
WHERE 
  key_id = '0a037e4388e0a27549028bb8602828ce0f1ee8542f99f3f201a8d0c41137ecc2' 
  AND (
    token = 'WD+kvg05ZOgQT16VAE+E6WapDlzB2l6Yy720vXpfJ6I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038