UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OQSlwB5ZyTqUY548CaNKMfwqjuDXNBpnKBXVBB6ZauU=' 
WHERE 
  key_id = '2841c068013459a5797e594654f1c5757deb4adb91699381fa13a21b8349756f' 
  AND (
    token = 'OQSlwB5ZyTqUY548CaNKMfwqjuDXNBpnKBXVBB6ZauU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079