UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gYn3F9SZu/c1vi7BlzZTK2cHwCn9FneKj79sTG3iS+c='
WHERE
key_id = '163aaa34955e122792a5024250381bf6b1f24f658ba9fbe9cd61723176aec3e9'
AND (
token = 'gYn3F9SZu/c1vi7BlzZTK2cHwCn9FneKj79sTG3iS+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)