UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M5cnk6yxEp9FkQF5eVnXGh6wJwgrBp+zjsG10z+xrAU=' 
WHERE 
  key_id = '90b19156705187fc477e734171deb6eed31580f532c7a62a61104a5b3895b0a7' 
  AND (
    token = 'M5cnk6yxEp9FkQF5eVnXGh6wJwgrBp+zjsG10z+xrAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030