UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uAnRQeM2EWPyvR6CpHHbTmiKxBmFz47VtKP6YfAXYlI='
WHERE
key_id = '687ca0c35f08ffacd95d19cd68a9521436906399c2bf0e87a6c85dc3890fab58'
AND (
token = 'uAnRQeM2EWPyvR6CpHHbTmiKxBmFz47VtKP6YfAXYlI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)