UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kWIIyoUiDBiCyh8JKp2SBe6pWdtE8Epp1QX3ePBuKXE='
WHERE
key_id = '9131bf3afab8b96755762c8255d700bf09399aec226c8e4fda4c7a877d362b4a'
AND (
token = 'kWIIyoUiDBiCyh8JKp2SBe6pWdtE8Epp1QX3ePBuKXE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)