UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihc4KX/yK1ezpB3SriCvnozDx7F8TiEFbMFzWt2+waE=' 
WHERE 
  key_id = 'e9656326c599ea0f42f6715df5663080d998acc4763bc129e0938d09b7e497e3' 
  AND (
    token = 'ihc4KX/yK1ezpB3SriCvnozDx7F8TiEFbMFzWt2+waE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020