UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fmrMo3fkgGqAQwFZMmwo2SBv4xzoofviBmg+8MGLqoU=' 
WHERE 
  key_id = '9f2837b5739bc313c5d0622ef7f399467198f2acbb504b27358572d99bdd0186' 
  AND (
    token = 'fmrMo3fkgGqAQwFZMmwo2SBv4xzoofviBmg+8MGLqoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034