UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hBjiaPYWbrVwqEmG3IQU/gu2y7iPzroeTDd9tW0Em0s=' 
WHERE 
  key_id = '640781d12cf4960c9f7ab988cd369f84c255fddbcae2f848a1633b9a6f5dc3d6' 
  AND (
    token = 'hBjiaPYWbrVwqEmG3IQU/gu2y7iPzroeTDd9tW0Em0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037