UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q5HMygP50Y/Lo89FtwcHWlZnJuw+LWlrNPfM/L+MUWs='
WHERE
key_id = 'd5877fcc2b6c3d32e01c26798f2dc540157994b9e9db9209e48c95327b453ec6'
AND (
token = 'Q5HMygP50Y/Lo89FtwcHWlZnJuw+LWlrNPfM/L+MUWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)