UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9i4mOK6C1zsv1OEzz7qVyzHTE0/7VddOZJjIrdQWKTM=' 
WHERE 
  key_id = 'f27c7492c75c4af5cfe7cd0079abc330d374c2fc0b5283a2ace48736857f6926' 
  AND (
    token = '9i4mOK6C1zsv1OEzz7qVyzHTE0/7VddOZJjIrdQWKTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027