UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8W2PkuPtBJq5d+Npnnjg+M8wlwb7OKhy2IHedoQOaL0='
WHERE
key_id = 'c9212e30ae83cec002b3ed68b3daa785986138502e7ab359698b5953b48f903a'
AND (
token = '8W2PkuPtBJq5d+Npnnjg+M8wlwb7OKhy2IHedoQOaL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)