UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CluC5VcIuWUtzO11cMvBibFTi8RwMSMVpeamHOi6woA=' 
WHERE 
  key_id = '907c22b653cf1e872b2986fec66dcdf416a852d6e461eba34334b3708b4a2336' 
  AND (
    token = 'CluC5VcIuWUtzO11cMvBibFTi8RwMSMVpeamHOi6woA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023