UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zIaFXiuJ1t5EMjs9lgpX2ZeJXUvzehBgNB0V0KLOAUA='
WHERE
key_id = 'd766333b47cfbe27f1ad96420aba5b41c21dcbe3632457345ec22045d6b40b68'
AND (
token = 'zIaFXiuJ1t5EMjs9lgpX2ZeJXUvzehBgNB0V0KLOAUA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)