UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUsMY7CSQ7wt9sd7umQ6G4+DmzWlwZp/27QKABk6+Kc=' 
WHERE 
  key_id = '7517f030ccd065b7398d83c94bb11789f71b78f480a4f1b4ef38374507e68b8a' 
  AND (
    token = 'KUsMY7CSQ7wt9sd7umQ6G4+DmzWlwZp/27QKABk6+Kc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055