UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UPTL85j94LUqIViA+wTknAYPcuJJaI+TafrH2TOQdLo=' 
WHERE 
  key_id = '4f0a21183ba58104961f53355fd1142d58bc65472ee50b7fe9efbff41f5ed53d' 
  AND (
    token = 'UPTL85j94LUqIViA+wTknAYPcuJJaI+TafrH2TOQdLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017