UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XOlNP/GBc1YqnJo9i8bkONCJgb3rEn+o+0lTVp1+rLw=' 
WHERE 
  key_id = '2f04a0f57e6fe3a9ef665ee1bf0c74a8b5abd6581871ec24701a0dd47f13c84b' 
  AND (
    token = 'XOlNP/GBc1YqnJo9i8bkONCJgb3rEn+o+0lTVp1+rLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026