UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NiWgzYVfNmGgRg4PuBh77OjoDke5fr0FNpsneC40vaM='
WHERE
key_id = '0c1b90d66f083ddb0c118c2d8213514a66afdea55a5132838df54ebb5dad6bc0'
AND (
token = 'NiWgzYVfNmGgRg4PuBh77OjoDke5fr0FNpsneC40vaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)