UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h1HfzX9ziY8J6OAiY5eg4uIUYxtHitppcYvNe3jiOus='
WHERE
key_id = '042fbd0f7f9ed6f165cf4e00b95fc44cc561e95449ebd5be76c95c14801c2ae2'
AND (
token = 'h1HfzX9ziY8J6OAiY5eg4uIUYxtHitppcYvNe3jiOus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)