UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PueAplCfSq0MpaYPq3AQHU2moYVZk4UmZDN+HAmmT+w='
WHERE
key_id = '3dbd41e82c6b32b6303a6a863ae42866c806b021fd9cf24911c67e1247055655'
AND (
token = 'PueAplCfSq0MpaYPq3AQHU2moYVZk4UmZDN+HAmmT+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)