UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M2KzpNXud1Nx/4OZrrwnmreVIgIA4kbqpgU42NTsXeI=' 
WHERE 
  key_id = '1cfe1d7546ac51a782d9e97bf64dbdb70037475298700de91430c647a65fcd83' 
  AND (
    token = 'M2KzpNXud1Nx/4OZrrwnmreVIgIA4kbqpgU42NTsXeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053