UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ldhec7vMLUkSZ367ZhWxHI/8WknGZZ9sMHqbNWGMoIE=' 
WHERE 
  key_id = 'f98431d60fab22fe8eaa3fc1f1bf17670ab5952faccd74ddd6d25aef80798241' 
  AND (
    token = 'ldhec7vMLUkSZ367ZhWxHI/8WknGZZ9sMHqbNWGMoIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034