UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pHJVTnvtLLbpqtTGX8Lg1RUdjdN+V8yE8DlHgxsFPAE=' 
WHERE 
  key_id = '1a5b8ff6cb79c316d54289ef626f76d6a2f59ec671d6b912ea74d78625ec8979' 
  AND (
    token = 'pHJVTnvtLLbpqtTGX8Lg1RUdjdN+V8yE8DlHgxsFPAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032