UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1IjEajTnX6wlwGVtMoR84HFUxKEXL5FtWboyB8iLg8=' 
WHERE 
  key_id = '3def0c4b02ab2224139a28caece4549a3e494d7efa2c3d0e204ca162f1f817f0' 
  AND (
    token = 'h1IjEajTnX6wlwGVtMoR84HFUxKEXL5FtWboyB8iLg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042