UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k5w9kDrwCMqxF/3pUnEjQ4mYuWMWHflNTEyu9Z8W8H4='
WHERE
key_id = '478ed1f65cc19a46a352b183341d5a59a3bb6e479b54c7c4b4a58f6916e5d831'
AND (
token = 'k5w9kDrwCMqxF/3pUnEjQ4mYuWMWHflNTEyu9Z8W8H4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)