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