UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b0+hesp8BCGyoqqAYwnWmwKj4oIbeLzxiHGjnZYYlRs='
WHERE
key_id = 'b3ff254485dd71a0a4f5f80f57025be0adc6662680d43cd0c300b65ee23ddb95'
AND (
token = 'b0+hesp8BCGyoqqAYwnWmwKj4oIbeLzxiHGjnZYYlRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)