UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q966fYZlvSHUGZDU21/WeZnYMq/scj2fvQZ/Yz/pzh8=' 
WHERE 
  key_id = '71764e7e3c592f18cecb772e2ec07f24addfdb57c17aee7177a3878b90ccd0e9' 
  AND (
    token = 'q966fYZlvSHUGZDU21/WeZnYMq/scj2fvQZ/Yz/pzh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042