UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P1Px4qSZOTEE+98BSf706TnI3E1XIb50+ce6gLtxoKs='
WHERE
key_id = '7976c3098cda5397c262eea21ba6079dae5bcf4516f3f809df7616a84032220d'
AND (
token = 'P1Px4qSZOTEE+98BSf706TnI3E1XIb50+ce6gLtxoKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)