UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '47FfgfAFowwatX3B8v6tQXd0HeJWhltAWFbGKa9Nx1M='
WHERE
key_id = 'e8c0213eebad17958bd1195445f2de0ab30bb24f3a4998a82f788e55bf1f1391'
AND (
token = '47FfgfAFowwatX3B8v6tQXd0HeJWhltAWFbGKa9Nx1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)