UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't083d8bn4wptSrjBT5Qc1skfm6UTYaAL5Wo7g0jYY+U=' 
WHERE 
  key_id = 'f09151924c2c3679ab717b74e4e9e1dcbdd0442c2e7185102a333c0179643828' 
  AND (
    token = 't083d8bn4wptSrjBT5Qc1skfm6UTYaAL5Wo7g0jYY+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038