UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HdQyeRWBrXzVVG6iHPMI/Scz0+0eovSnyTHlOv+fV/s=' 
WHERE 
  key_id = '6e48a504c3a4917255d449ac15a8c2fbeab9ef357551aad2fafa739b27f17531' 
  AND (
    token = 'HdQyeRWBrXzVVG6iHPMI/Scz0+0eovSnyTHlOv+fV/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034