UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'laCSvVx3anVAmRyOk45gTCCb8xnxj2GRqr5ufPQHIWM=' 
WHERE 
  key_id = 'd80738f9b450e9fde5d92ddb6494dac4531d67ccf94f292ff24917345e3626cd' 
  AND (
    token = 'laCSvVx3anVAmRyOk45gTCCb8xnxj2GRqr5ufPQHIWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043