UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '36XcJaLnbK4+wpve1ekS71YhjgOnHlgBuRuIDWsSINg='
WHERE
key_id = '3d151c76b9852b33100d6bfc0d64fd619db2725302ad24fbf6947aad3a54668f'
AND (
token = '36XcJaLnbK4+wpve1ekS71YhjgOnHlgBuRuIDWsSINg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)