UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vzgNjg78U0l1dxsE4ggWNMY0Zs1O13tIOw9owwilt+k=' 
WHERE 
  key_id = '4259150215d9b25b4a61209f33b5092138662e3817376d7c07146c8ab4cfac64' 
  AND (
    token = 'vzgNjg78U0l1dxsE4ggWNMY0Zs1O13tIOw9owwilt+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023