UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LrPL8ZZqAj1w7NiO5EbBPL4fnc/ROfVuevwZ14zYfpU=' 
WHERE 
  key_id = 'bbaf410eda13d49a3924e62564ded7e6413e9ef0c7c72201d3d179dd2f6806cb' 
  AND (
    token = 'LrPL8ZZqAj1w7NiO5EbBPL4fnc/ROfVuevwZ14zYfpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034