UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0xNQQN3GH9rp8qk4FoNJh+bk0uz79j/zIUm+B17rJ+4='
WHERE
key_id = '447f5f748afa8bc262553598ebb095ac73f8c4e2e99a197393f7d75e2ba3b236'
AND (
token = '0xNQQN3GH9rp8qk4FoNJh+bk0uz79j/zIUm+B17rJ+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)