UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ED1Y3jUf2j0E2wZDfh+W5IEL/NTq7jHm69sMdVwlDgA=' 
WHERE 
  key_id = '99505373634adf7a52b8c634f1f8bcc1a8e5ff9ad042f938d42c1a9710a02e90' 
  AND (
    token = 'ED1Y3jUf2j0E2wZDfh+W5IEL/NTq7jHm69sMdVwlDgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032