UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bN8tYMWEJV9miCQqlFkgAbJ15G9884rjs4HJ2SbgGCM='
WHERE
key_id = '8ed0db8531e80923b019128fcdf118b7718b3af573acc2ddf4f65f41d41f0c55'
AND (
token = 'bN8tYMWEJV9miCQqlFkgAbJ15G9884rjs4HJ2SbgGCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)