UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2KyTrA5Y9JsSOLb7TKOM3D9Lf7yWxiav5JpukwrTVxY='
WHERE
key_id = 'b87bd6f7b94e14670e6ef7b82db5af503a2fb72933defb456bde830a8d3d7684'
AND (
token = '2KyTrA5Y9JsSOLb7TKOM3D9Lf7yWxiav5JpukwrTVxY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)