UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bi/L3310DBP1gKYYzddCSv7CfXNzpe7CwRHhNVxzcYs='
WHERE
key_id = 'a5b0450532b3f7a545efd4552311da2f5ee3b3771a7b4f366bb93643bf3e9473'
AND (
token = 'bi/L3310DBP1gKYYzddCSv7CfXNzpe7CwRHhNVxzcYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)