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